-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Improve E2E tests with ESLint rules #29041
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit bb3301c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
@@ -8,14 +8,14 @@ | |||
"vitest", | |||
"testing" | |||
], | |||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/addons/vitest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks <3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
19 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings
/* eslint-disable playwright/no-conditional-expect */ | ||
|
||
/* eslint-disable playwright/no-conditional-in-test */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: These ESLint disables might be masking potential issues in the test code. Consider addressing the underlying problems instead of disabling the rules.
).toBeVisible(); | ||
|
||
await page.locator('[id="storybook\\@7\\.6\\.18_components-badge"]').click(); | ||
await expect( | ||
await page.locator('[id="storybook\\@7\\.6\\.18_components-badge--default"]') | ||
page.locator('[id="storybook\\@7\\.6\\.18_components-badge--default"]') | ||
).toBeVisible(); | ||
|
||
// Expect composed stories `to be available in the search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: There's a backtick in the comment that should be removed
|
||
const noAutodocsAnchor = await root.locator('#anchor--core-tags-remove--no-autodocs').all(); | ||
expect(noAutodocsAnchor.length).toBe(0); | ||
// Autodocs should include autodocs and exclude dev, test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: This comment is incorrect. It should be 'Autodocs should include no-dev, no-test and exclude no-autodocs'
What I did
Initially I fixed some flaky tests by converting to auto-retrying assertions.
Then I realised this this the third time I do this, so I installed and configured eslint-plugin-playwright to hopefully ensure it won't happen again. This required a lot of fixing of all the E2E tests, so I did that too.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
This PR improves the E2E tests for Storybook by implementing ESLint rules for Playwright tests and updating test files to use more robust practices.